package d.k;

import d.e;
import d.h.a.b;
import java.util.Iterator;
import java.util.NoSuchElementException;

final class c implements d.j.a<d.i.c> {
    /* access modifiers changed from: private */

    /* renamed from: a  reason: collision with root package name */
    public final CharSequence f2711a;
    /* access modifiers changed from: private */

    /* renamed from: b  reason: collision with root package name */
    public final int f2712b;
    /* access modifiers changed from: private */

    /* renamed from: c  reason: collision with root package name */
    public final int f2713c;
    /* access modifiers changed from: private */

    /* renamed from: d  reason: collision with root package name */
    public final b<CharSequence, Integer, d.c<Integer, Integer>> f2714d;

    public static final class a implements Iterator<d.i.c> {

        /* renamed from: b  reason: collision with root package name */
        private int f2715b = -1;

        /* renamed from: c  reason: collision with root package name */
        private int f2716c;

        /* renamed from: d  reason: collision with root package name */
        private int f2717d;
        private d.i.c e;
        private int f;
        final /* synthetic */ c g;

        a(c cVar) {
            this.g = cVar;
            int c2 = f.c(cVar.f2712b, 0, cVar.f2711a.length());
            this.f2716c = c2;
            this.f2717d = c2;
        }

        /* JADX WARNING: Code restructure failed: missing block: B:6:0x0021, code lost:
            if (r0 < d.k.c.c(r6.g)) goto L_0x0023;
         */
        /* Code decompiled incorrectly, please refer to instructions dump. */
        private final void a() {
            /*
                r6 = this;
                int r0 = r6.f2717d
                r1 = 0
                if (r0 >= 0) goto L_0x000c
                r6.f2715b = r1
                r0 = 0
                r6.e = r0
                goto L_0x0099
            L_0x000c:
                d.k.c r0 = r6.g
                int r0 = r0.f2713c
                r2 = -1
                r3 = 1
                if (r0 <= 0) goto L_0x0023
                int r0 = r6.f
                int r0 = r0 + r3
                r6.f = r0
                d.k.c r4 = r6.g
                int r4 = r4.f2713c
                if (r0 >= r4) goto L_0x0031
            L_0x0023:
                int r0 = r6.f2717d
                d.k.c r4 = r6.g
                java.lang.CharSequence r4 = r4.f2711a
                int r4 = r4.length()
                if (r0 <= r4) goto L_0x0047
            L_0x0031:
                int r0 = r6.f2716c
                d.i.c r1 = new d.i.c
                d.k.c r4 = r6.g
                java.lang.CharSequence r4 = r4.f2711a
                int r4 = d.k.n.g(r4)
                r1.<init>(r0, r4)
            L_0x0042:
                r6.e = r1
            L_0x0044:
                r6.f2717d = r2
                goto L_0x0097
            L_0x0047:
                d.k.c r0 = r6.g
                d.h.a.b r0 = r0.f2714d
                d.k.c r4 = r6.g
                java.lang.CharSequence r4 = r4.f2711a
                int r5 = r6.f2717d
                java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
                java.lang.Object r0 = r0.a(r4, r5)
                d.c r0 = (d.c) r0
                if (r0 != 0) goto L_0x0073
                int r0 = r6.f2716c
                d.i.c r1 = new d.i.c
                d.k.c r4 = r6.g
                java.lang.CharSequence r4 = r4.f2711a
                int r4 = d.k.n.g(r4)
                r1.<init>(r0, r4)
                goto L_0x0042
            L_0x0073:
                java.lang.Object r2 = r0.a()
                java.lang.Number r2 = (java.lang.Number) r2
                int r2 = r2.intValue()
                java.lang.Object r0 = r0.b()
                java.lang.Number r0 = (java.lang.Number) r0
                int r0 = r0.intValue()
                int r4 = r6.f2716c
                d.i.c r4 = d.i.f.e(r4, r2)
                r6.e = r4
                int r2 = r2 + r0
                r6.f2716c = r2
                if (r0 != 0) goto L_0x0095
                r1 = 1
            L_0x0095:
                int r2 = r2 + r1
                goto L_0x0044
            L_0x0097:
                r6.f2715b = r3
            L_0x0099:
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: d.k.c.a.a():void");
        }

        /* renamed from: b */
        public d.i.c next() {
            if (this.f2715b == -1) {
                a();
            }
            if (this.f2715b != 0) {
                d.i.c cVar = this.e;
                if (cVar != null) {
                    this.e = null;
                    this.f2715b = -1;
                    return cVar;
                }
                throw new e("null cannot be cast to non-null type kotlin.ranges.IntRange");
            }
            throw new NoSuchElementException();
        }

        public boolean hasNext() {
            if (this.f2715b == -1) {
                a();
            }
            return this.f2715b == 1;
        }

        public void remove() {
            throw new UnsupportedOperationException("Operation is not supported for read-only collection");
        }
    }

    public c(CharSequence charSequence, int i, int i2, b<? super CharSequence, ? super Integer, d.c<Integer, Integer>> bVar) {
        d.h.b.c.c(charSequence, "input");
        d.h.b.c.c(bVar, "getNextMatch");
        this.f2711a = charSequence;
        this.f2712b = i;
        this.f2713c = i2;
        this.f2714d = bVar;
    }

    public Iterator<d.i.c> iterator() {
        return new a(this);
    }
}
